package com.ddzh.web;

import com.ddzh.dto.RoleDto;
import com.ddzh.dto.UserDto;
import com.ddzh.dto.UserRoleDto;
import com.ddzh.entity.PageReq;
import com.ddzh.entity.PageRes;
import com.ddzh.entity.Result;
import com.ddzh.pojo.Role;
import com.ddzh.pojo.User;
import com.ddzh.service.RoleService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/roleController")
public class RoleController {

    @Reference
    private RoleService roleService;

    @PostMapping("/save")
    public Result save(@RequestBody RoleDto roleDto){
        return new Result(roleService.saveOrUpdateRole(roleDto));
    }

    @PostMapping("/findAll")
    public Result findAll(@RequestBody PageReq pageReq){
        return new Result(roleService.findAll(pageReq));
    }





//    @PostMapping("/findByPage")
//    public Result findByPage(@RequestBody PageReq pageReq){
//        PageRes<User> pageRes = roleService.findByPage(pageReq);
//        return new Result(pageRes);
//    }
//
//    @PostMapping("/update")
//    public Result update(@RequestBody Role user){
//        return new Result(roleService.updateById(user));
//    }

//    @GetMapping("/delete")
//    public Result delete(Long id){
//        return new Result(roleService.deleteById(id));
//    }

}
